home *** CD-ROM | disk | FTP | other *** search
- /*
- ** routine to put a comment box around the selected text
- ** adapted from Mike Haas's 'slide' routine
- */
-
- BOXWIDTH=72 /* Width of the comment box */
-
- OPTIONS results
-
- 'get' "select position" /* get the select boundary, if any */
-
- if (result == "NO SELECT") then /* is nothing selected? */
- exit /* Then just go back */
-
- parse var result startx ' ' starty ' ' endx ' ' endy
- LinesSelected = (endy - starty)
-
- /* if only the 'eol' of the previous line is selected
- (nothing on this line is actually included, i.e. x==0),
- then don't include it.
- */
- if (endx > 0) then LinesSelected = LinesSelected + 1
-
- 'prefs' autoindent read; autoindent = result
-
- 'unselect'
- 'gotoxy' 0 starty
- 'textn' '/' || copies('*', BOXWIDTH-1)
- do LinesSelected
- /* At this point we are in column zero of a line to be
- ** included in the comment box. We go down a line and then left
- ** one char to get to the end of the line, and pad with spaces
- ** so that the '*' line up properly
- */
- 'text' '"* "'
- /*
- 'text' '* '
- */
- 'left' 2
- 'down' 1
- 'left' 1
- 'get' "cursor position"
- parse var result curx cury
- 'text' '"' || copies(' ', BOXWIDTH-curx-1) || '*"'
- 'right' 1
- end
-
- 'textn' copies('*', BOXWIDTH-1) || '/'
-
- 'prefs' 'autoindent' autoindent
- exit
-
-